<?php

if (isset($_SESSION["sessionID"])) {
	session_destroy();
}
session_start();
//casa
//$conexion=mysql_connect("instance6485.db.xeround.com.:4769","subeuser","subepass");

//cole
$conexion = mysql_connect("192.168.130.206", "subeuser", "subepass") or die("Error al conectar");
	mysql_select_db("sube_schema", $conexion);

if (!isset($_SESSION["sessionID"]) && (isset($_POST['username'])) && (isset($_POST['password']))) {

		$consulta = mysql_query("select * from clients", $conexion);
	while ($fila = mysql_fetch_array($consulta)) {
		if (($fila['usuario'] == trim($_POST["username"])) && ($fila['password'] == (trim($_POST["password"])))) {
			$_SESSION["sessionID"] = session_id();
			$_SESSION["username"] = $fila['usuario'];
			$_SESSION["idClient"]=$fila['id_clients'];

		}
	}
}

?>

